package com.jml.task.entity;

import com.jml.task.lock.Lock;
import com.jml.task.utils.TranslationUtils;
import org.springframework.transaction.TransactionStatus;


public class LockInfo {
    /**
     * lockId
     */
    private String lockId;
    /**
     * 锁的线程
     */
    private Thread lockThread;
    /**
     * 状态 start 开始使用的状态 stop状态 锁释放了
     */
    private String state;


    /**
     * 保存分布式 lock 锁
     */
    private Lock lock;

    /**
     * 记录事务的信息
     */
    private TranslationUtils translationUtils;

    private TransactionStatus transactionStatus;

    /**
     * 事务
     *
     * @param lockId
     * @param lockThread
     * @param state
     * @param lock
     */

    public LockInfo(String lockId, Thread lockThread, String state, Lock lock, TranslationUtils translationUtils,
                    TransactionStatus transactionStatus) {
        this.lockId = lockId;
        this.lockThread = lockThread;
        this.state = state;
        this.lock = lock;
        this.translationUtils = translationUtils;
        this.transactionStatus = transactionStatus;
    }

    public LockInfo(String lockId, Thread lockThread, String state, Lock lock) {
        this.lockId = lockId;
        this.lockThread = lockThread;
        this.state = state;
        this.lock = lock;
    }

    public String getLockId() {
        return lockId;
    }

    public Thread getLockThread() {
        return lockThread;
    }

    public String getState() {
        return state;
    }

    public Lock getLock() {
        return lock;
    }

    public TransactionStatus getTransactionStatus() {
        return transactionStatus;
    }

    public TranslationUtils getTranslationUtils() {
        return translationUtils;
    }
}
